Skip to content

Commit

Permalink
aufs: bugfix, IMA i_readcount
Browse files Browse the repository at this point in the history
By the recent commit
	21913077f9918 2020-06-17 aufs: do not call i_readcount_inc()
a very old bug was fixed, which is inblance counter.
But still aufs needs to call i_readcount_inc() when the branch
permission is chaned from RW to RO.  Otherwise the counter reaches 0
and BUG() in i_readcount_dec() will be activated.

Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
  • Loading branch information
sfjro committed Jun 18, 2020
1 parent 515a586 commit f10aea5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/aufs/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
unsigned char verbose, writer;
struct file *file, *hf, **array;
struct au_hfile *hfile;
struct inode *h_inode;

mnt_flags = au_mntflags(sb);
verbose = !!au_opt_test(mnt_flags, VERBOSE);
Expand Down Expand Up @@ -1287,7 +1288,10 @@ static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex)
hf->f_mode &= ~(FMODE_WRITE | FMODE_WRITER);
spin_unlock(&hf->f_lock);
if (writer) {
put_write_access(file_inode(hf));
h_inode = file_inode(hf);
if (hf->f_mode & FMODE_READ)
i_readcount_inc(h_inode);
put_write_access(h_inode);
__mnt_drop_write(hf->f_path.mnt);
}
}
Expand Down

0 comments on commit f10aea5

Please sign in to comment.